package com.hubu.utils;

import java.util.Comparator;
import java.util.HashMap;

/**
 * @description:
 * @author: hubu
 * @time: 2023/4/2 13:54
 */
public class HashMapComparator implements Comparator<HashMap<String, Object>> {
    private String key;
    public HashMapComparator(String key) {
        this.key = key;
    }
    @Override
    public int compare(HashMap<String, Object> o1, HashMap<String, Object> o2) {
        return ((Comparable) o2.get(key)).compareTo(o1.get(key));
    }
}